<template>
  <div class="jibing-chaxun">
    <!-- <div class="input">
      <input placeholder="请输入想要查询的部位" @focus="tojibingsearch">
    </div> -->
    <div class="d-f">
        <input type="text" placeholder="请输入想要查询的部位" @click="tojibingsearch">
        <div class="sousuo" @click="tojibingsearch">搜索</div>
    </div>
    <div class="top">
      <div :class="{color:select == index+1}"
          @click="selectItem($event,index+1)"
          v-for="(list, index) in tabs"
          :key="index">{{list.name}}
          <span class="heng" v-if="select == index+1"></span>
      </div>
    </div>
    <div class="gray"></div>
    <!-- 人群查询 -->
    <div class="box" v-if="select == 1">
      <div class="box-l">
        <div :class="{baicolor:renqunsel == index}" 
            @click="renqunselectItemleft($event,index)" 
            v-for="(item,index) in classifyrq" 
            :key="index">
            <img  :src="'static/classify/'+ select + index+'.png'" alt="">
            {{item.name}}
        </div>
      </div>
      <div class="box-r">
        <div v-for="(item,index) in renqunsellist" 
            :key="index"
            :id='item.article_id'
            @click="todetails($event,item.article_id,item.title)" 
            >{{item.title}}</div>
      </div>
    </div>
    <!-- 部位查询 -->
    <div  class="box boxx"  v-if="select == 2">
      <div class="buwei-box"  >
        <img src="../../assets/img/bg.png" alt="">

        <div class="img">
          <div class="left">
            <div class="itemdanxuan" :class="[buweisel==index?'itemxuanzhong':'']"
              v-for="(item,index) in classifybwleft " 
              :key="index"
              @click="buweiselectItem($event,index)"
            >{{item.name}}</div>
          
          </div>
          <div class="min">
            <img src="../../assets/img/renti.png" alt="">
          </div>
          <div class="right">
              <div class="itemdanxuan" :class="[buweisel==index+6?'itemxuanzhong':'']"
              v-for="(item,index) in classifybwright " 
              :key="index"
              @click="buweiselectItem($event,index+6)"
            >{{item.name}}</div>
          </div>
        </div>
       
      </div>
      <div class="alldisease">
        <div v-for="(item,index) in buweisellist"
        :key="index"
        @click="todetails($event,item.article_id,item.title)"
        >{{item.title}}</div>
       
      </div>
    </div>

    <!-- 科室查询 -->
    <div class="box"  v-if="select == 3">
      <div class="box-l">
        <div :class="{baicolor:keshisel == index}" 
            @click="keshiselectItemleft($event,index)" 
            v-for="(item,index) in classifyks" 
            :key="index">
            <img :src="'static/classify/'+select+index+'.png'" alt="">
            {{item.name}}
        </div>
      </div>
      <div class="box-r">
        <div v-for="(item,index) in keshisellist" 
            :key="index"
             @click="todetails($event,item.article_id,item.title)"
            >{{item.title}}</div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name:'disease-query',
    data() {
      return {
       tabs:[
         {name:'人群查询',color:true},
         {name:'部位查询',color:false},
         {name:'科室查询',color:false}
       ],
       

       renqunsel:0,
       renqunsellist:'',
       keshisel:0,
       keshisellist:'',

       buweisel:0,
       buweisellist:'',

       select:1,
       classifyrq:'',
       classifybw:'',
       classifyks:'',

       classifybwleft:'',
       classifybwright:'',
      }
    },
    methods: {
      // 顶部  筛选
      selectItem(e,index){
        if (index == 1) {
          this.select = 1;
        } else if (index == 2) {
          this.select = 2;
        } else if (index == 3) {
          this.select = 3;
        }
      },
      // 人群查询 left
      renqunselectItemleft(e,index){
       this.renqunsel=index
       this.renqunsellist=this.classifyrq[index].list
      },
      // 科室查询 left
      keshiselectItemleft(e,index){
        this.keshisel=index
        this.keshisellist=this.classifyks[index].list
      },

      // 部位
      buweiselectItem(e,index){
        this.buweisel=index
        this.buweisellist=this.classifybw[index].list
      },
      // 去详情
      todetails(e,id,title){

        this.$router.push({
          name:'bingzheng-jieshao',
          params: {
                  id:id,
                  title:title
                  }
        }) 
      },

      tojibingsearch(){
         this.$router.push({
          name:'jibing-search',
        }) 
      },

      // 获取分类
      getclassify(index){
        this.$get("api/gzh_index.php?action=symptoms_list", {
          type:index
        }).then(res => { 
          console.log(res.data,'res')
          if(index==1){
            this.classifyrq = res.data
            this.renqunsellist=res.data[0].list
          }
          if(index==2){
            this.classifybw = res.data
            this.classifybwleft=res.data.slice(0,6)
             this.classifybwright=res.data.slice(6,12)
             this.buweisellist=res.data[0].list
          }
          if(index==3){
            this.classifyks = res.data
            this.keshisellist=res.data[0].list
          }
          
        }).catch(err => {
          
        });
      }
    },
    created () {
      this.getclassify(1);
      this.getclassify(2);
      this.getclassify(3);
    },
  }
</script>

<style scoped>
.jibing-chaxun{
  width: 100%;
  height:100%;
}
.d-f{
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding-top: 20px;
}
.jibing-chaxun{
  width: 100%;
  height:100%;
}

input{
  width: 80%;
  height: 73px;
  outline: none;
  border:none;
  border: 1PX solid #F2F2F2;
  border-radius: 15px;
  padding: 0 20px;
  box-sizing: border-box;
  font-size:26px;
  line-height: 26px;
  font-family:PingFang SC;
  font-weight:500;
}
.sousuo{
    width:10%;
    height:50px;
    font-size: 26px;
    line-height: 50px;
    background-color: rgba(6,162,85,1);
    color: #fff;
    text-align: center;
    margin-right:20px;
}
.top{
  width: 100%;
  height: 122px;
  padding: 0 30px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.top div{
  font-size:30px;
  height: 122px;
  font-family:PingFang SC;
  font-weight:500;
  color:rgba(102,102,102,1);
  position: relative;
  line-height: 122px;
}
.top .color{
  color: #06A255;
}
.heng{
  display: block;
  width:40px;
  height:7px;
  background:rgba(6,162,85,1);
  border-radius:4px;
  position: absolute;
  bottom: 20px;
  left: 33%;
}
/* 人群查询 */
.gray{
  width: 100%;
  height: 15px;
  background: #f7f7f7;
}
.box{
  width: 100%;
  height:calc(100% - 217px);
  /* display: flex;
  justify-content: space-between; */
  overflow: hidden;
}
.boxx{
  overflow: hidden;
  overflow-y: scroll;
}
.box-l{
  overflow: hidden;
    overflow-y: auto;
  float: left;
  width: 297px;
  height: 100%;
  background: #f6f6f6;
}
.box-l div{
  width: 297px;
  height: 70px;
  background: #f6f6f6;
  font-size: 28px;
  color: #333;
  /* text-align: center; */
  text-indent: 40px;
  line-height: 70px;
}
.box-l div img{
  width: 43px;
  /* height: 38px; */
  vertical-align:middle;
  margin-right: 10px;
}
.box-l .baicolor{
  background: #fff;
  color:rgba(6,162,85,1);
  font-size: 28px;
}
.box-r{
  float: right;
  width: calc(100% - 297px);
  height: 100%;
  overflow: hidden;
  overflow-y: auto;
}
.box-r div{
  width: 100%;
  height: 70px;
  line-height: 70px;
  font-size: 28px;
  color: #333;
  padding-left: 30px;
  box-sizing: border-box;
}
.buwei-box{
  width:100%;
  height:850px;
 
  position: relative;
}
.buwei-box img,.buwei-box .img{
  width:100%;
  height:100%;
  position: absolute;
  top:0;
  left:0;
   display: flex;
  justify-content: space-around;
}
.left ,.right{
  width:140px;
  height:763px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.min{
  position: relative;
  width:372px;
  height:729px;
  margin-top:52px;
}
.min img{
  width:100%;
  height:100%;
  position: absolute;
  top:0;
  left:0;
}

.itemdanxuan{
  font-size:28px;
  width:140px;
  height:60px;
  /* background:rgba(6,162,85,1); */
  border:1PX solid rgba(153,153,153,1);
  border-radius:10px;
  text-align: center;
  line-height: 60px;
  margin-top:41px;
  color:rgba(102,102,102,1);
  box-sizing: border-box;
}
.itemxuanzhong{
  color:rgba(255,255,255,1)!important;
  background:rgba(6,162,85,1)!important;
   border:none!important;
}
.qianhou{
  position: absolute;
  bottom:0;
  left:0;
  width:100%;
  display: flex;
  justify-content: space-around;
}

.alldisease{
  width:692px;
  height:240px;
  background:rgba(255,255,255,1);
  box-shadow:0px -2px 7px 0px rgba(102,102,102,0.15);
  border-radius:8px;
  margin:20px auto;


  font-size:28px;
  font-family:PingFang SC;
  font-weight:500;
  color:rgba(102,102,102,1);
  line-height:60px;

  padding: 30px;
  box-sizing: border-box;
}
.alldisease div{
  margin-right:20px; 
  float: left;
}

</style>